package cn.ygh.bbo.common.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author ygh
 * @Desc ip工具
 * @date 2019/11/26
 */
public class IpUtils {
    public static String getHostIp() {
        try {
            return InetAddress.getLocalHost().getHostAddress();
        }
        catch (UnknownHostException e) {
        }
        return "127.0.0.1";
    }

    public static String getHostName() {
        try {
            return InetAddress.getLocalHost().getHostName();
        }
        catch (UnknownHostException e) {
        }
        return "未知";
    }
}
